﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using HF.Framework.SqlDataContract;
using HF.Framework.DataClientDBAgent;

namespace HF.Architecture.Data
{
    [Serializable]
    public class EmpDefault_Value
    {

        public string UserID
        {
            get;
            set;
        }

        public string DeptID
        {
            get;
            set;
        }

        public string DeptName
        { get; set; }


        public string PostID
        {
            get;
            set;
        }

        public string PostName
        {
            get;
            set;
        }

        public string FilialeID
        {
            get;
            set;
        }

        public string Filiale
        {
            get;
            set;
        }

        public string CreatedTime
        {
            get;
            set;
        }

        public EmpDefault_Value(string UserID)
        {

            try
            {
                SqlDataItem sqlItem = new SqlDataItem();
                sqlItem.CommandText = "sp_workflowAndformdefaultbyLoginName";
                sqlItem.CommandType = CommandType.StoredProcedure.ToString();
                sqlItem.AppendParameter("@LoginName", UserID);
                ClientDBAgent agent = new ClientDBAgent();
                DataTable dt=agent.ExecuteDataTable(sqlItem);
                if(dt.Rows.Count>0)
                {
                      DataRow dr=dt.Rows[0];
                      this.UserID =UserID;
                      this.DeptID = (dr["DeptID"] == null) ? "" : dr["DeptID"].ToString();
                      this.DeptName = (dr["DeptName"] == null) ? "" : dr["DeptName"].ToString();
                      this.PostID = (dr["PostID"] == null) ? "" : dr["DeptName"].ToString();
                      this.PostName = (dr["PostName"] == null) ? "" : dr["PostName"].ToString();
                      this.FilialeID = (dr["FilialeID"] == null) ? "" : dr["FilialeID"].ToString();
                      this.Filiale = (dr["Filiale"] == null) ? "" : dr["Filiale"].ToString();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }


        }
    }
}
